export function uniqueArr(array, attr = null) {
  if (!Array.isArray(array)) return "uniqueArr传入非数组，请检查参数";
  if (attr === null) return [...new Set(array)];
  return [
    ...array
      .reduce((pre, cur) => {
        pre.get(cur[attr]) === undefined && pre.set(cur[attr], cur);
        return pre;
      }, new Map())
      .values(),
  ];
}
